package com.ls.aop.security;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class PermissionService {
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	public boolean isAllowed() {
		String user=CurrentUserHolder.getCurrentUser();
		if("admin".equals(user)) {
			logger.info("allowed operation ");
			return true;
		}
		logger.info("current user not allow operation will throw runtime exception ");
		throw new RuntimeException("current user not allow operation");
	}
}
